﻿@using BrnMall.Manager
@using BrnMall.Manager.Domain.Product
@model BrnMall.Web.StoreAdmin.Models.ProductAppointListModel

          
@section header{
    <title>预约列表-预约评价</title>
    <link type="text/css" rel="stylesheet" href="/admin_store/css/site.css"/>
    <!--tip样式-->
    <link type="text/css" rel="stylesheet" href="/components/jquery_tips/tipso.min.css">
    <script type="text/javascript" src="/admin_store/scripts/jquery.js"></script>
    <script type="text/javascript" src="/admin_store/scripts/showlist.js"></script>
    <link href="/components/jbox/Skins/Default/jbox.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="/components/jbox/jquery.jBox-2.3.min.js"></script>
    <script type="text/javascript" src="/admin_store/scripts/selectlist.js"></script>
    <script type="text/javascript" src="/components/my97datepicker/WdatePicker.js"></script>
    <script type="text/javascript" src="/components/jquery_tips/tipso.min.js"></script>
    <script type="text/javascript">
        /*状态*/
        $(function () {
            $(".updateState").click(function () {
                var obj = $(this);
                var state = obj.attr("state");
                var message = "";
                var url = "";
                   message = "您确认要执行此操作吗？";
                   url = obj.attr("url") + "&state=" + state + "&t=" + new Date();
                
                $.jBox.confirm(message, "提示", function (v, h, f) {
                    if (v == 'ok') {
                        $.jBox.tip("正在设置...", 'loading');
                        $.get(url, function (data, textStatus) {
                            if (data != "0") {
                                if (state == "2") {
                                    obj.parents("tr").find(".stateTd").html("已确认");
                                }
                                else if (state == "3") {
                                    obj.parents("tr").find(".stateTd").html("已拒绝");
                                }
                                $.jBox.tip('设置成功！', 'success');
                            } else {
                                $.jBox.error('设置失败，请联系管理员！', '设置失败');
                            }
                        });
                    }
                    else if (v == 'cancel') {
                        // 取消
                    }

                    return true; //close
                });

                return false;
            });

            /*鼠标移动的提示*/
            $('.tips').tipso({ useTitle: false, background: '#ff8427' });
        })
    </script>
}
@section body{
    <h1 class="rightH1">
		微信小程序 &gt; 预约评价 &gt; <span class="rightH1-cur">预约列表</span> 
        <div class="right"><div class="clear"></div></div>
        <div class="clear"></div>
    </h1>
    @using (Html.BeginForm("productappointlist", "productappoint"))
    {
        <div class="dataListSearch">
            <table height="32">
                <tbody class="col4">
                <tr>
                    <td class="td1">
						<span>商品：</span>
                        <div class="selectBt">
                            <input type="button" value="@Model.ProductName" onclick="openProductSelectLayer(this)" style="height:22px; line-height:22px;background:url(/admin_store/images/selectbgico.gif) no-repeat 6px center; padding-left:22px; padding-right:10px;"/>
                            <input type="hidden" class="Pid" id="Pid" name="Pid" value="@Model.Pid" />
                            <input type="hidden" class="ProductName" id="ProductName" name="ProductName" value="@Model.ProductName" />
                        </div>           
                    </td>                    
					<td class="td2">账号：@Html.TextBox("AccountName", Model.AccountName, new { height = "28", size = "15" })</td>
					 <td class="td3">开始时间：@Html.TextBox("startTime", Model.AppointStartTime, new { height = "18", onclick = "WdatePicker({el:'startTime'})" })</td>
                    <td class="td4">结束时间：@Html.TextBox("endTime", Model.AppointEndTime, new { height = "18", onclick = "WdatePicker({el:'endTime'})" })</td>
                    <td>
                        <input id="SearchProductConsult" name="SearchProductConsult" type="image" class="searchBut submit"
                               src="/admin_store/images/s.jpg" />
                    </td>
                </tr>
                </tbody>
            </table>
        </div>
        <div class="dataList">
            <table width="100%">
                <thead>
                <tr>
                    <th width="30" align="center"><input type="checkbox" id="allSelect" /></th>
                    <th width="100" align="left">预约人</th>
                    <th width="100" align="left">联系电话</th>
                    <th width="150" align="left">预约类型</th>
                    <th align="left">预约项</th>
                    <th width="100" align="left">预约时间</th>
                    <th width="140" align="left">创建时间</th>
                    <th width="60" align="left">状态</th>
                    <th width="105" align="left">管理操作</th>
                </tr>
                </thead>
                <tbody>
                @foreach (ProductAppoint app in Model.Result.Items)
                {
                    <tr>
                        <td align="center"><input type="checkbox" value="@app.AppointId" selectitem="true" name="appointIdList" /></td>
                        <td>@app.RealName</td>
                        <td>@app.Phone</td>
                        <td>@switch (app.AppointType)
						{
							case 0:
                                    @:预约商品
                                    break;
							case 1:
                                    @:预约餐位
                                    break;
						}</td>
                        <td>
                            
                            <div class="tips" style="border-bottom:0px;" data-tipso="人数：@app.DiningTableUserTotal 人 <br/>备注：@app.Remark">
                               @switch (app.AppointType)
                               {
                                   case 0:
                                       if (!string.IsNullOrEmpty(app.PName))
                                       {
                                        @app.PName
                                       }
                                       else
                                       {
                                        @: 无
                                }
                                       break;
                                   case 1:
                                       if (!string.IsNullOrEmpty(app.DiningTableTypeName))
                                       {
                                        @app.DiningTableTypeName
                                       }
                                       else
                                       {
                                        @: 无
                                }
                                       break;
                               }
                            </div>                         
                        </td>
                        <td>@app.ApplyTime.ToString("yyyy-MM-dd HH:mm:ss")</td>
                        <td>@app.CreatedTime.ToString("yyyy-MM-dd HH:mm:ss")</td>
                        <td class="stateTd">
                            @if (app.Status == 0)
							{
                                @:待确认
                            }
							else if (app.Status == 1)
							{
                                @:已取消
                            }
							else if (app.Status == 2)
							{
                                @:已确认
                            }
							else
							{
                                @:被拒绝
                            }
                        </td>
                        <td>
                            @if (app.Status == 0)
							{
                                <a href="#" url="@Url.Action("UpdateProductAppointState", new { appointId = app.AppointId })" state="2" class="editOperate updateState">确认</a>
								<span class="btn-line">|</span>
								<a href="#" url="@Url.Action("UpdateProductAppointState", new { appointId = app.AppointId })" state="3" class="editOperate updateState">拒绝</a>
							    <br />
							}							
                            @Html.ActionLink("关闭", "DelProductAppoint", new { appointIdList = app.AppointId }, new { @class = "deleteOperate" })
                        </td>
                    </tr>
                }
                </tbody>
            </table>
        </div>
        <div class="dataListEdit">
            <a href="#" delUrl="@Url.Action("DelProductAppoint")" class="batch batchDel">批量关闭</a>
            <div class="page">
                @Html.StoreAdminPager(Model.PageModel)
            </div>
        </div>
    }
}
